<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
	<%@ taglib prefix="sf" uri="http://www.sf-express.com/tags" %>
	<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
	<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
	<script type="text/javascript">
	 $(document).ready(function() { 
		 
		 $("#form").validator({},{
				callback:function(results){
					$("#form").ajaxSubmit(function(data) {
			        	 myDialog.close();
			        	 myDialog =  art.dialog({icon: data.success,content: data.message,lock:true});
			        	 $("#gridTable").trigger("reloadGrid", [{page:1}]); 
			         }); 
				}
			});
		 
     }); 
	 
	 function checkRoleName() {
		 	var $target = $("#name");
			var result = new Object();
			result.result = true;
			result.msg = "验证通过";
			var pattern = new RegExp("[`~!@#$^&*=|{}':;',\\[\\].<>/?~！@#￥……&*（）——|{}【】‘；：”“'。，、？]");
			if($.trim($target.val()) != "" && $.trim($target.val()).match(pattern)){
				result.result = false;
				result.msg = "不能包含特殊字符";
			}
			return result;
		}
	</script> 
			<form  method="post" id="form" action="role/add"> 
			<sf:token id="add_role"/>
				<ul class="all_list">
					<li>
						<span class="all_title">角色名称：</span> 
						<span><input type="text" id="name" name="name" class="ui_input" validator='{"label":"角色名称","maxLength":20,"customFun":"checkRoleName"}' /></span>
					</li>
					<li>
						<span class="all_title">角色层级：</span> 
						<span><select name="roleLevel" id="roleLevel" validator='{"label":"角色层级"}'>
								<option value="">请选择</option>
									<c:if test="${!empty roleLevel}">
										<c:forEach var="level" items="${roleLevel }">
											<option value="${level.dataCode }">${level.dataName }</option>
										</c:forEach>
									</c:if>
							</select>
						</span>
					</li>
					<li>
						<span class="all_title">业务类型：</span> 
							<span><select name="systemCode" id="systemCode" validator='{"label":"角色层级"}' >
									<option value="">请选择</option>
									<c:if test="${!empty systemMap}">
										<c:forEach var="sys" items="${systemMap }">
											<option value="${sys.key }">${sys.value.systemName }</option>
										</c:forEach>
									</c:if>
								</select></span>
					</li>
					<li>
						<span class="all_title">角色编号：</span> 
						<span><input type="text" id="code" name="code" class="ui_input" maxlength="3"  validator='{"label":"角色编号","maxLength":3,"minLength":3,"isDigit":true}'/></span>
					</li>
					<li>
						
						
						<span class="all_title">角色归属：</span> 
						<span><select name="source" id="source" validator='{"label":"角色归属"}'>
								<option value="">请选择</option>
								<c:if test="${!empty source}">
									<c:forEach var="item" items="${source }">
										<option value="${item }">${item.name }</option>
									</c:forEach>
								</c:if>
							</select>
						</span>
					</li>
					<li>
							<span class="all_title">备注：</span>
							<span><input type="text" class="ui_input" name="remark" id="remark"  validator='{"label":"备注","maxLength":30,"required":false}'/></span>
					</li>
					<li>
							<span class="all_title"></span>
							<span><shiro:hasPermission name="operator:add"><input type="button" id="addButton" class="submit_btn submitBtn"  name="addButton"  value="提 交"></shiro:hasPermission></span>
					</li>
				</ul>
			</form>
